/*
 * samplerRECT = Non power-of-two, non mipmapped 2D texture.
 * uniform = value is initialised by an external source.
 * The output is float4 (r,g,b,a)
 *
 * Semantics COLOR, TEXCOORD0 etc. indicate the hardware
 * resource that the respective member feeds when the CG program
 * returns from its output structure.
 */
void genConvFunc(
        in float2            coord   : TEXCOORD0,
        uniform samplerRECT  d_data  : TEXUNIT0,
        uniform int          d_size,
        uniform float        d_w,
        out float4           output  : COLOR
)
{
    float twopi = 3.141592654f;
    float x = (coord.x - (float)d_size / 2.0f) / (float)d_size;
    float y = (coord.y - (float)d_size / 2.0f) / (float)d_size;
    output.r = x; // store the x coordinate value in red
    output.g = y; // store the y coordinate value in green
    output.b = cos(x * d_w * twopi) * sin(y * d_w * twopi);
    output.a = cos(x * d_w * twopi);
}
